package com.zh.search.domain.dto;

import com.zh.web.enums.Status;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.elasticsearch.annotations.Setting;

import java.io.Serializable;
import java.time.LocalDateTime;

@Data
@Document(indexName = "article")
@Setting(settingPath = "elasticsearch/article_es_mapping.json")
public class ArticleEsDto implements Serializable {
    private static final long serialVersionUID = 1L;
    private static final String DATE_TIME_PATTERN = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
    /**
     * id
     */
    @Id
    private Long id;
    /**
     * 标题
     */
    private String title;
    /**
     * 副标题
     */
    private String subTitle;
    /**
     * 作者
     */
    private String author;
    /**
     * 简介
     */
    private String summary;
    /**
     * 内容
     */
    private String content;
    /**
     * 创作类型
     */
    private String creationType;
    /**
     * 内容类型
     */
    private String contentType;
    /**
     * 法条类型
     */
    private String lawType;
    /**
     * 创建时间
     */
    @Field(type = FieldType.Date, format = {}, pattern = DATE_TIME_PATTERN)
    private LocalDateTime createTime;
    /**
     * 更新时间
     */
    @Field(type = FieldType.Date, format = {}, pattern = DATE_TIME_PATTERN)
    private LocalDateTime updateTime;
    /**
     * 文章创建人
     */
    private Long createOperator;
    /**
     * 点赞量
     */
    private Integer praiseCount;
    /**
     * 分享量
     */
    private Integer shareCount;
    /**
     * 浏览量
     */
    private Integer viewCount;
    /**
     * 收藏量
     */
    private Integer collectCount;
    /**
     * 状态 0 1 2 3 4 5
     */
    private Status status;
}
